<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:mochi="http://www.mochikit.com/">
  <xi:include href="master.html" />

<title>VMs</title>
<head>

<script type = "text/javascript">
var temp_sort_key = 1; //specify the column to sort when loading the page
</script>

<script type = "text/javascript" src="/cloudcrvjs/sortable_tables.js"></script>
<script type = "text/javascript" src="/cloudcrvjs/general_format.js"></script>
<script type = "text/javascript" src="/cloudcrvjs/ibox.js"></script>
<!--ibox must go after sortable_tables-->

<!--using onload causes problems with sortable_tables; used addLoadEvent (seems like a MochiKit function)-->
<script type = "text/javascript">
addLoadEvent(function () { pageload("vms"); });
</script>

</head>

<!--see roles2.html for documentation about how tables are made-->

<body onUnload = "unload('vms');">

<div style="overflow:auto; width:800px; height: 600px;">
<table border = "1" id="sortable_table" class="datagrid">
    <thead>
      <tr>
          <th mochi:format="int" style="cursor:pointer">VM_ID</th>
          <th mochi:format="str" style="cursor:pointer">Name</th>
	  <th mochi:format="str" style="cursor:pointer">Current Status</th>
	  <th mochi:format="str" style="cursor:pointer">Target Status</th>
	  <th mochi:format="str" style="cursor:pointer">Identifier</th>
	  <th mochi:format="str" style="cursor:pointer">PublicIP</th>
	  <th mochi:format="str" style="cursor:pointer">PrivateIP</th>
	  <th mochi:format="str" style="cursor:pointer">Attributes</th>
	  <th mochi:format="str" style="cursor:pointer">Roles</th>
      </tr>
    </thead> 
    <tbody>
      <div py:for="i in range(0, len(vms))">
        <tr>
	    <td>
	      ${vms[i].VM_ID}</td>
	    <td>
	      ${vms[i].getAttr("name")}</td>
	    <td bgcolor="${SC_colors[vms[i].currentSC % len(SC_colors)]}">
	      <font color = "black">
	      ${SC_table[vms[i].currentSC]}</font></td>
	    <td bgcolor="${SC_colors[vms[i].targetSC % len(SC_colors)]}">
	      <font color = "black">
	      ${SC_table[vms[i].targetSC]}</font></td>
	    <td>
	      ${vms[i].getAttr("identifier")}</td>
	    <td>
	      ${vms[i].getAttr("PublicIPV4")}</td>
	    <td>
	      ${vms[i].getAttr("PrivateIPV4")}</td>

	    <td>     
	      <a href = "${'/dispvm/'+vms[i].getAttr('name')+'/attr'}" rel = "ibox">Show</a></td>
	    <td>
	      <a href = "${'/dispvm/'+vms[i].getAttr('name')+'/roles'}" rel = "ibox">Show</a></td>
	</tr>
      </div>
    </tbody>
</table>
</div>

</body>

</html>